<!DOCTYPE html>
<html>
<head>
    {include file='public/meta'/}
    <link rel="stylesheet" type="text/css" href="__STATIC_URL__/static/member/css/core.css?v=13"/>

    <link rel="stylesheet" type="text/css" href="__STATIC_URL__/static/member/css/member-info.css"/>
    <link rel="stylesheet" type="text/css" href="__STATIC_URL__/static/css/getlists.css"/>
    <link rel="stylesheet" type="text/css" href="__STATIC_URL__/static/bootstrap-table/bootstrap-table.css"/>

    <style>
        .nav.nav-tabs {
            border-bottom: 1px solid #ddd;
        }
        .modal-body .nav > li.active > a::before {
            border: none;
        }
        .modal-body .nav > li > a {

            background: none;
        }
        .gift-record select, .gift-record input {
            display: inline-block;
            width: 40%;
            float: left;
        }
        .addcord {
            padding: 0;
            margin-top: 5px;
        }
    </style>
    <script>
        // 会员信息
        var getcarduserinfos = "{:url('Cardusers/getcarduserinfo')}";
        // 编辑会员信息
        var getcarduseredits = "{:url('Cardusers/getcarduseredit')}";

        //消费信息
        var getcarduserxfinfos = "{:url('Cardusers/getcarduserxfinfo')}";
        // 备注
        var getremarklists = "{:url('Cardusers/getremarklist')}";
        // 优惠券
        var getcardusercardslists = " {:url('Cardusers/getcardusercardslist')}";

        // 消费记录
        var getcarduserxflists = "{:url('Cardusers/getcarduserxflist')}";
        // 微信消费记录
        var getcarduserwxxflists = "{:url('cardusers/getcardwxxflist')}";
        // 充值记录
        var getcarduserczlists = " {:url('Cardusers/getcarduserczlist')}";

        // 积分
        var getcarduserbonuslists = "{:url('Cardusers/getcarduserbonuslist')}";

        // 查看编辑会员信息
        var getcarduseredits = "{:url('Cardusers/getcarduseredit')}";

        var getbonusbizputs = "{:url('cardusextend/getbonusbizput')}";

        var sendbonusbizcards = "{:url('cardus/sendbonusbizcard')}";
        var requestnames = "  {:url('pay/requestname')}";
        var sendcardsxx = "{:url('cardus/sendmassbonus')}";
    </script>
</head>
<body>
{include file='public/header'/}
<!------------------导航-------------------------->
<section id="content">
    {include file='public/left'/}
    <!--------------------------主要内容区域------------------------------------->
    <div class="content">
        <div class="page-heading mgl15 mgr15">
            <!--路径导航-->
            <ol class="breadcrumb">
                <li>当前位置是:</li>
                <li>
                    <a href="javascript:;">会员卡管理</a>
                </li>

                <li class="active" style="color: #02b87f;">会员列表</li>
            </ol>

        </div>


        <div class="panel panel-default mgl15 mgr15">
            <div class="panel-heading">
                <h5 class="panel-title">
                    会员

                </h5>
            </div>
            <div class="panel-body">
                <ul class="fenxilist clearfix">
                    <li class="col-sm-3">
                        <div>领卡会员</div>
                        <div>{$carduser.count}人</div>
                    </li>
                    <li class="col-sm-3">
                        <div>激活会员</div>
                        <div>{$carduser.fire}人</div>
                    </li>
                    <li class="col-sm-3">
                        <div>未激活会员</div>
                        <div>{$carduser.notfire}人</div>
                    </li>
                    <li class="col-sm-3">
                        <div>删卡会员</div>
                        <div>{$carduser.nothave}人</div>
                    </li>
                </ul>
            </div>
        </div>

        <div class="panel panel-default panel-search mgl15 mgr15">
            <div class="panel-heading">
                <h5 class="panel-title"><span class="glyphicon glyphicon-search pull-left"
                                              style="margin-right: 10px;"></span>会员查找</h5>
            </div>
            <div class="panel-body">
                <form action="" method="get" class="form-horizontal table-search form-search" role="form" id="machform">
                    <div class="col-sm-6 col-md-6 col-lg-4 ">
                        <div class="form-group">
                            <label class="col-sm-3 control-label">选择门店：</label>
                            <div class="col-sm-9">
                                <select name="gs_mid" class="form-control" id="gs_mid">
                                    <option value="">请选择</option>
                                    {volist name="machlist" id="vo"}
                                    <option value="{$vo['mid']}">{$vo['merchant']}</option>
                                    {/volist}
                                </select>
                            </div>
                        </div>
                    </div>
                    <div class="col-sm-6 col-md-6 col-lg-4 ">
                        <div class="form-group">
                            <label class="col-sm-3 control-label">昵称：</label>
                            <div class="col-sm-9">
                                <input type="text" autocomplete="off" class="form-control" placeholder="请输入" value=""
                                       name="nickname" id="nicknames">
                            </div>
                        </div>
                    </div>
                    <div class="col-sm-6 col-md-6 col-lg-4 ">
                        <div class="form-group">
                            <label class="col-sm-3 control-label">卡号：</label>
                            <div class="col-sm-9">
                                <input type="text" autocomplete="off" class="form-control" placeholder="请输入卡号" value=""
                                       name="code" id="codes">
                            </div>
                        </div>
                    </div>
                    <div class="col-sm-6 col-md-6 col-lg-4 ">
                        <div class="form-group">
                            <label class="col-sm-3 control-label">激活状态：</label>
                            <div class="col-sm-9">
                                <select name="fire" class="form-control" id="fire">
                                    <option value="">请选择激活状态</option>
                                    <option value="1">已激活</option>
                                    <option value="0">未激活</option>
                                </select>
                            </div>
                        </div>
                    </div>
                    <div class="col-sm-6 col-md-6 col-lg-4 ">
                        <div class="form-group">
                            <label class="col-sm-3 control-label">会员状态：</label>
                            <div class="col-sm-9">
                                <select name="stauts" class="form-control" id="stauts">
                                    <option value="">请选择会员状态</option>
                                    <option value="1">正常</option>
                                    <option value="2">停用</option>
                                </select>
                            </div>
                        </div>
                    </div>
                    <div class="col-sm-6 col-md-6 col-lg-4 ">
                        <div class="form-group">
                            <label class="col-sm-3 control-label">积分筛选：</label>
                            <div class="col-sm-9">
                                <select name="bonus_scr" class="form-control" id="bonus_scr">
                                    <option value="">请选择排序</option>
                                    <option value="1">从高到低</option>
                                    <option value="2">从低到高</option>
                                </select>
                            </div>
                        </div>
                    </div>
                    <div class="col-sm-6 col-md-6 col-lg-4 ">
                        <div class="form-group">
                            <label class="col-sm-3 control-label">余额筛选：</label>
                            <div class="col-sm-9">
                                <select name="balance_scr" class="form-control" id="balance_scr">
                                    <option value="">请选择排序</option>
                                    <option value="1">从高到低</option>
                                    <option value="2">从低到高</option>
                                </select>
                            </div>
                        </div>
                    </div>
                    <div class="col-sm-6 col-md-6 col-lg-4 ">
                        <div class="form-group">
                            <label class="col-sm-3 control-label">领取时间筛选：</label>
                            <div class="col-sm-9">
                                <select name="get_scr" class="form-control" id="get_scr">
                                    <option value="">请选择排序</option>
                                    <option value="1">从早到晚</option>
                                    <option value="2">从晚到早</option>
                                </select>
                            </div>
                        </div>
                    </div>
                    <div class="col-sm-6 col-md-6 col-lg-4">
                        <div class="form-group">
                            <label class="col-sm-3 control-label">积分筛选：</label>
                            <div class="col-sm-9">
                                <div class="input-group">
                                    <input name="min_bonus" type="text" value="" placeholder="最低积分" class="form-control"
                                           id="min_bonus">
                                    <div class="input-group-addon">至</div>
                                    <input name="max_bonus" type="text" value="" class="form-control" placeholder="最高积分"
                                           id="max_bonus">
                                </div>
                            </div>
                        </div>
                    </div>
                    <div class="col-sm-6 col-md-6 col-lg-4">
                        <div class="form-group">
                            <label class="col-sm-3 control-label">余额筛选：</label>
                            <div class="col-sm-9">
                                <div class="input-group">
                                    <input name="min_balance" type="text" value="" placeholder="最低余额"
                                           class="form-control" id="min_balance">
                                    <div class="input-group-addon">至</div>
                                    <input name="max_balance" type="text" value="" class="form-control"
                                           placeholder="最高余额" id="max_balance">
                                </div>
                            </div>
                        </div>
                    </div>
                    <div class="col-sm-6 col-md-6 col-lg-4">
                        <div class="form-group">
                            <label class="col-sm-3 control-label">领取时间筛选：</label>
                            <div class="col-sm-9">
                                <div class="input-group">
                                    <input name="times" type="text" value=""
                                           readonly="readonly" id="times" class="form-control"
                                           placeholder="请选择" style="width: 297px">
                                </div>
                            </div>
                        </div>
                    </div>
                    {eq name=":session('login_top_mid')" value="1"}

                    <div class="col-sm-6 col-md-6 col-lg-4">
                        <div class="form-group">
                            <label class="col-sm-3 control-label">会员消费：</label>
                            <div class="col-sm-9">
                                <div class="input-group">
                                    <input name="last_day" type="number" value="" placeholder="天数" class="form-control"
                                           id="last_day">
                                    <div class="input-group-addon">天内未消费</div>
                                </div>
                            </div>
                        </div>
                    </div>
                    <div class="col-sm-6 col-md-6 col-lg-4">
                        <div class="form-group">
                            <label class="col-sm-3 control-label">会员生日：</label>
                            <div class="col-sm-9">
                                <div class="input-group">
                                    <input name="birthday_day" type="text" value="" placeholder="天数"
                                           class="form-control" id="birthday_day">
                                    <div class="input-group-addon">天内生日</div>
                                </div>
                            </div>
                        </div>
                    </div>
                    {/eq}
                    <div class="col-sm-6 col-md-6 col-lg-4 ">
                        <div class="form-group">
                            <label class="col-sm-3 control-label">消费积分筛选：</label>
                            <div class="col-sm-9">
                                <select name="con_bonus_scr" class="form-control" id="con_bonus_scr">
                                    <option value="">请选择排序</option>
                                    <option value="1">从高到低</option>
                                    <option value="2">从低到高</option>
                                </select>
                            </div>
                        </div>
                    </div>
                    <div class="col-sm-6 col-md-6 col-lg-4 ">
                        <div class="form-group">
                            <label class="col-sm-3 control-label">消费余额筛选：</label>
                            <div class="col-sm-9">
                                <select name="con_balance_scr" class="form-control" id="con_balance_scr">
                                    <option value="">请选择排序</option>
                                    <option value="1">从高到低</option>
                                    <option value="2">从低到高</option>
                                </select>
                            </div>
                        </div>
                    </div>
                    <div class="col-sm-6 col-md-6 col-lg-4 ">
                        <div class="form-group">
                            <label class="col-sm-3 control-label">充值余额筛选：</label>
                            <div class="col-sm-9">
                                <select name="add_balance_scr" class="form-control" id="add_balance_scr">
                                    <option value="">请选择排序</option>
                                    <option value="1">从高到低</option>
                                    <option value="2">从低到高</option>
                                </select>
                            </div>
                        </div>
                    </div>
                </form>
            </div>
            <div class="panel-footer">
                <a href="javascript:;" class="btn btn-primary" onclick="searchforms()">查找</a>
                <a href="javascript:;" class="btn btn-default" onclick="clearform()">清空</a>
            </div>
        </div>

        <div class="panel mgl15 mgr15">
            <div class="panel-heading addCharts" style="background:#ededed;">
                会员列表


                <a href="{:url('marke/importuser')}" class="btn btn-default pull-right mgl15" style="margin-top: -6px;">导入会员</a>

                <a href="javascript:;" class="btn btn-default pull-right mgl15" data-target="#myModal5"
                   data-toggle="modal" style="margin-top: -6px;">会员群发</a>
                <div class="num pull-right mgl15" style="text-align: right; ">当前查询会员数量：<span id="carduser"></span>人
                </div>

            </div>
            <div class="panel-body">
                <table class="table table-bordered table-hover" data-toolbar="#toolbar" id="tablelist">

                </table>
            </div>
        </div>
        {include file='public/footer'/}
    </div>
</section>
<!-- 充值Modal -->
<div class="modal fade" id="czModal" tabindex="-1" role="dialog" aria-labelledby="myModalLabel">
    <div class="modal-dialog" role="document">
        <div class="modal-content">
            <div class="modal-header">
                <button type="button" class="close" data-dismiss="modal" aria-label="Close"><span aria-hidden="true">&times;</span>
                </button>
                <h4 class="modal-title" id="czModalLabel">会员卡充值</h4>
            </div>
            <div class="modal-body">
                <form class="form-horizontal" id="cz">
                    <div class="form-group">
                        <label class="col-sm-2 control-label">会员昵称：</label>
                        <div class="col-sm-10">
                            <label id="czcard-name" class="control-label"></label>

                        </div>
                    </div>
                    <div class="form-group">
                        <label class="col-sm-2 control-label">会员卡号：</label>
                        <div class="col-sm-10">

                            <label id="czcard-code" class="control-label"></label>
                        </div>
                    </div>
                    <div class="form-group">
                        <label class="col-sm-2 control-label">门店：</label>
                        <div class="col-sm-10">
                            <input type="hidden" name="id" id="czcard-id">
                            <select name="mid" id="czhe-md" class="form-control" required="required">
                                <option value="">选择门店</option>
                                {volist name="machlist" id="vo"}
                                <option value="{$vo.mid}">{$vo.merchant}</option>
                                {/volist}
                            </select>
                        </div>
                    </div>
                    <div class="form-group">
                        <label class="col-sm-2 control-label">核销员：</label>
                        <div class="col-sm-10">
                            <input type="text" name="username" id="cznickname" readonly="readonly" required="required"
                                   class="form-control" value="{$user.nickname}">
                        </div>
                    </div>
                    <div class="form-group">
                        <label class="col-sm-2 control-label">充值类别：</label>
                        <div class="col-sm-10">
                            <select id="cz-kind" class="form-control" required="required"
                                    onchange="czkindfun(this.value)">
                                <option value="1">余额</option>
                                <option value="2">积分</option>
                            </select>
                        </div>
                    </div>
                    <div id="czshow">
                        <div class="form-group">
                            <label class="col-sm-2 control-label">充值面额：</label>
                            <div class="col-sm-10">
                                <select name="giveid" id="czme" class="form-control">
                                    <option value="">其他金额</option>
                                    {volist name="czgive" id="me"}
                                    <option value="{$me.id}"
                                            data-money="{$me.zs_money}{if condition='$me.zs_money' neq ''}元{/if}"
                                            data-zsnew="{:getgivecardnew($me.zs_card_id_all,0)}"
                                            data-zs="{:getgivecard($me.zs_card_id,0)}">充值{$me.cz_money}元
                                    </option>
                                    {/volist}
                                </select>
                            </div>
                        </div>
                        <div class="form-group hidden" id="czsm-wrap">
                            <label class="col-sm-2 control-label">赠送：</label>
                            <div class="col-sm-10">
                                <div class="form-self" id="czsm"></div>
                            </div>
                        </div>
                    </div>
                    <div class="form-group" id="czje">
                        <label class="col-sm-2 control-label" id="czname">充值金额：</label>
                        <div class="col-sm-10">
                            <input type="hidden" name="type" id="czmodal-type">
                            <input type="number" maxlength="8" name="add_balance" id="czadd_balance"
                                   oninput="if(isNaN(value))execCommand('undo')" required="required"
                                   class="form-control" value="">
                        </div>
                    </div>
                    <div class="form-group">
                        <label class="col-sm-2 control-label">充值说明：</label>
                        <div class="col-sm-10">
                            <textarea name="record_balance" id="czrecord_balance" rows="3" style="resize: none;"
                                      required="required" class="form-control">后台充值</textarea>
                            <div class="r-desc">请对本次余额操作进行说明</div>
                        </div>
                    </div>
                </form>
            </div>
            <div class="modal-footer">
                <button type="button" class="btn btn-default" data-dismiss="modal">取消</button>
                <button type="button" class="btn btn-primary" id="czsure">确认</button>
            </div>
        </div>
    </div>
</div>

<!-- 核销Modal -->
<div class="modal fade" id="hexiaoModal" tabindex="-1" role="dialog" aria-labelledby="myModalLabel">
    <div class="modal-dialog" role="document">
        <div class="modal-content">
            <div class="modal-header">
                <button type="button" class="close" data-dismiss="modal" aria-label="Close"><span aria-hidden="true">&times;</span>
                </button>
                <h4 class="modal-title" id="hexiaoModalLabel">会员卡核销</h4>
            </div>
            <div class="modal-body">
                <form class="form-horizontal" id="hexiao">
                    <div class="form-group">
                        <label class="col-sm-2 control-label">会员昵称：</label>
                        <div class="col-sm-10">
                            <label id="card-name" class="control-label"></label>

                        </div>
                    </div>
                    <div class="form-group">
                        <label class="col-sm-2 control-label">会员卡号：</label>
                        <div class="col-sm-10">

                            <label id="card-code" class="control-label"></label>
                        </div>
                    </div>
                    <div class="form-group">
                        <label class="col-sm-2 control-label">门店：</label>
                        <div class="col-sm-10">
                            <input type="hidden" name="id" id="card-id">
                            <select name="mid" id="he-md" class="form-control" required="required">
                                <option value="">选择门店</option>
                                {volist name="machlist" id="md"}
                                <option value="{$md.mid}">{$md.merchant}</option>
                                {/volist}
                            </select>
                        </div>
                    </div>
                    <div class="form-group">
                        <label class="col-sm-2 control-label">核销类型：</label>
                        <div class="col-sm-10">
                            <select id="he-type" class="form-control" required="required"
                                    onchange="changetype(this.value)">
                                <option value="1">金额</option>
                                <option value="2">积分</option>
                            </select>
                        </div>
                    </div>
                    <div class="form-group">
                        <label class="col-sm-2 control-label">核销员：</label>
                        <div class="col-sm-10">
                            <input type="text" name="username" id="nickname" readonly="readonly" required="required"
                                   class="form-control" value="{$user.nickname}">
                        </div>
                    </div>
                    <div class="form-group">
                        <label class="col-sm-2 control-label" id="he-name">核销金额：</label>
                        <div class="col-sm-10">
                            <input type="hidden" name="type" id="modal-type">
                            <input type="number" maxlength="8" name="add_balance" id="add_balance"
                                   oninput="if(isNaN(value))execCommand('undo')" required="required"
                                   class="form-control" value="">
                        </div>
                    </div>
                    <div class="form-group">
                        <label class="col-sm-2 control-label">核销说明：</label>
                        <div class="col-sm-10">
                            <textarea name="record_balance" id="record_balance" rows="3" style="resize: none;"
                                      required="required" class="form-control">后台核销</textarea>
                            <div class="r-desc">请对本次余额操作进行说明</div>
                        </div>
                    </div>
                </form>
            </div>
            <div class="modal-footer">
                <button type="button" class="btn btn-default" data-dismiss="modal">取消</button>
                <button type="button" class="btn btn-primary" id="hxsure">确认</button>
            </div>
        </div>
    </div>
</div>
<!--<&#45;&#45;会员卡详情&ndash;&gt;-->
<div class="side-bar right-bar">
    <i class="ti-close side_close_btn">
    </i>

    <div class="user_info">
        <div class="contact-card">
            <a class="pull-left" href="#">
                <img class="img-circle" alt id="head_imgUrl" src="">
            </a>
            <div class="member-info">
                <h4 class="m-t-0 m-b-5 ">
                    <b id="head_memberName">会员姓名：</b>
                    <input type="hidden" id="cid" data-id="">
                    <input type="hidden" id="openid" data-id="">
                    <input type="hidden" id="code" data-id="">
                    <input type="hidden" id="top_mid" data-id="">
                    <span id="member_grade_name" class="margin-0-10"> 普通会员</span>
                </h4>
                <p class="text-muted">
                    <span id="head_memberMobile">手机号码：</span>
                </p>
                <p class="text-dark">
                    <small id="head_nickName">会员昵称：
                    </small>
                </p>
            </div>
        </div>
        <div class="btn-group text-btn right show_operator_btn" role="group">
            <button class="btn btn-link waves-effect" style="height:100%;" id="member_detail_edit"
                    onclick="editMember()">
                <i class="glyphicon glyphicon-pencil">
                </i>
                编辑

            </button>
        </div>
    </div>
    <div class="side-page-content">
        <div class="col-lg-12" style=" padding: 0px; ">
            <ul class="nav nav-tabs tabs" data-w="800" tab-w="100" style="width: 100%;" id="myTab">
                <li class="tab active">
                    <a href="#member-info" data-toggle="tab" id="member-info-id">会员信息</a>
                </li>
                <li class="tab">
                    <a href="#member-assets" data-toggle="tab" onclick="getcarduserxfinfo();">消费信息</a>
                </li>
                <li class="tab">
                    <a href="#member-consume" data-toggle="tab" onclick="getcarduserxflist();">
                        <span class="hidden-xs">消费记录</span>
                    </a>
                </li>
                <li class="tab">
                    <a href="#member-wxconsume" data-toggle="tab" onclick="getcarduserwxxflist();">
                        <span class="hidden-xs">微信消费记录</span>
                    </a>
                </li>
                <li class="tab">
                    <a href="#member-recharge" data-toggle="tab" onclick="getcarduserczlist();">
                        <span class="hidden-xs">充值记录</span>
                    </a>
                </li>
                <li class="tab">
                    <a href="#member-point" data-toggle="tab" onclick="getcarduserbonuslist();">
                        <span class="hidden-xs">积分记录</span>
                    </a>
                </li>
                <li class="tab">
                    <a href="#member-coupon" data-toggle="tab" onclick="getcardusercardslist();">
                        <span class="hidden-xs">优惠券</span>
                    </a>
                </li>

                <li class="tab">
                    <a href="#member-redenvelope" data-toggle="tab" onclick="getremarklist();">
                        <span class="hidden-xs">备注记录</span>
                    </a>
                </li>
            </ul>
            <div class="tab-content" style=" padding: 0px; margin-bottom: 0px; ">
                <div class="tab-pane fade in active" id="member-info">
                    <div id="locus_tit" class="locus_tit">
                        <p class="first">
                        <span>
                            <strong>会员资产</strong>
                        </span>
                        </p>
                        <p>
                            <span>
                                <i class="glyphicon glyphicon-credit-card">
                                </i> 总余额：
                                <em id="member_zbalance">-</em>元
                            </span>
                            <span>
                                <i class="glyphicon glyphicon-credit-card">
                                </i>  实充余额：
                                <em id="member_charge">-</em>元
                            </span>
                            <span>
                                <i class="md md-credit-card">
                                </i>   赠送余额：
                                <em id="member_give">-</em>元
                            </span>
                            <span>
                                <i class="glyphicon glyphicon-fire">
                                </i>  经验值：
                                <em id="member_experience">0</em>
                            </span>
                            <span>
                                <i class="glyphicon glyphicon-star-empty">
                                </i>  积分：
                                <em id="member_integral">-</em>分
                            </span>
                            <!--<span>-->
                            <!--<i class="glyphicon glyphicon-gift">-->
                            <!--</i>  红包：-->
                            <!--<em id="member_envelopes">0</em>元-->
                            <!--</span>-->
                            <span>
                                <i class="glyphicon glyphicon-bookmark">
                                </i>  优惠券：
                                <em id="member_Coupon">-</em>张
                            </span>


                        </p>
                    </div>
                    <div id="locus_tit" class="locus_tit">
                        <p class="first">
                        <span>
                            <strong>基础信息</strong>
                        </span>
                        </p>
                        <p>
                            <span>
                               会员卡号：
                                <em id="member_number">--</em>
                            </span>
                            <span>
                                  手机号码：
                                <em id="member_phone">--</em>
                            </span>
                            <span>
                                  所属门店：
                                <em id="member_shop">--</em>
                            </span>
                            <span>
                                会员等级：
                                <em id="member_grade">--</em>
                            </span>
                            <!--<span>-->
                            <!--领卡方式：-->
                            <!--<em id="collar_card">&#45;&#45;</em>-->
                            <!--</span>-->
                            <span>
                                 推荐人：
                                <em id="Recommend">--</em>
                            </span>
                            <span>
                                 会员性别：
                                <em id="member_sex">--</em>
                            </span>
                            <span>
                                会员生日：
                                <em id="member_birth">--</em>
                            </span>
                            <span>
                                 会员年龄：
                                <em id="member_no">--</em>
                            </span>
                            <span>
                                 会员星座：
                                <em id="member_constellation">--</em>
                            </span>
                            <span>
                                 注册日期：
                                <em id="member_register">--</em>
                            </span>
                            <span>
                                 公众号关注：
                                <em id="member_follow">--</em>
                            </span>
                            <span>
                                会员绑定：
                                <em id="binding">微信</em>
                            </span>


                            <span>
                                 会员邮箱：
                                <em id="member_email">--</em>
                            </span>
                            <span>
                                所在地址：
                                <em id="member_address">--</em>
                            </span>
                            <!--<span>-->
                            <!--所在省份：-->
                            <!--<em id="member_sf">中国</em>-->
                            <!--</span>-->
                            <!--<span>-->
                            <!--所在城市：-->
                            <!--<em id="member_cs">中国</em>-->
                            <!--</span>-->


                        </p>
                    </div>
                    <div id="locus_tit" class="locus_tit">
                        <p class="first">
                        <span>
                            <strong>扩展信息</strong>
                        </span>
                        </p>
                        <p>
                            <span>
                                备注：
                                <em id="member_expt">--</em>
                            </span>


                        </p>
                    </div>
                    <div class="locus_tit">
                        <p class="first">
                        <span>
                            <strong>其他信息</strong>
                        </span>
                        </p>
                        <p>
                            <span>
                                 最近使用设备：
                                <em id="member_equipment">--</em>
                            </span>
                            <span>
                                 最近使用ip：：
                                <em id="member_ip">--</em>
                            </span>
                            <span>
                              最近定位地址：
                                <em id="member_Location">--</em>
                            </span>
                            <span>
                               最近使用网络：
                                <em id="member_network">--</em>
                            </span>

                        </p>
                    </div>
                </div>
                <div class="tab-pane fade" id="member-assets">
                    <div id="locus_tit" class="locus_tit">
                        <p class="first">
                        <span>
                            <strong>消费统计</strong>
                        </span>
                        </p>
                        <p>
                            <span>
                                 累计消费金额：
                                <em id="del_balance">--</em>元
                            </span>
                            <span>
                                累计充值金额：
                                <em id="xfadd_balance">--</em>元
                            </span>
                            <span>
                                微信累计支付次数：
                                <em id="wx_balance">--</em>次
                            </span>
                            <span>
                             累计获得积分：
                                <em id="add_bonus">--</em>
                            </span>
                            <span>
                              累计消费笔数：
                                <em id="xf_nume">--</em>笔
                            </span>
                            <span>
                              累计充值次数 ：
                                <em id="cz_nume">--</em>次
                            </span>
                            <span>
                               累计使用积分：
                                <em id="del_bonus">--</em>
                            </span>
                            <span>
                             累计获得优惠券：
                                <em id="get_cards">--</em>个
                            </span>
                            <span>
                             累计退款次数：
                                <em id="member_network">--</em>次
                            </span>

                        </p>
                    </div>
                    <div id="locus_tit" class="locus_tit">
                        <p class="first">
                        <span>
                            <strong>最近消费</strong>
                        </span>
                        </p>
                        <p>
                            <span>
                                 最近消费门店：
                                <em id="member_merchant">--</em>
                            </span>
                            <span>
                                最近消费金额：
                                <em id="member_pay_balance">--</em>元
                            </span>
                            <span>
                             最近购买商品数量 ：
                                <em id="member_Location">--</em>
                            </span>
                            <span>
                              最近消费时间：
                                <em id="member_pay_time">--</em>
                            </span>


                        </p>
                    </div>
                    <div id="locus_tit" class="locus_tit">
                        <p class="first">
                        <span>
                            <strong>平均消费</strong>
                        </span>
                        </p>
                        <p>
                            <span>
                                 平均客消费：
                                <em id="pjdel_balance">--</em>元
                            </span>
                            <span>
                                平均客充值：
                                <em id="pjadd_balance">--</em>元
                            </span>
                            <span>
                            平均件单价：
                                <em id="member_Location">--</em>元
                            </span>
                            <span>
                              平均消费折扣 ：
                                <em id="discount">--</em>元
                            </span>


                        </p>
                    </div>
                </div>
                <div class="tab-pane fade" id="member-consume">
                    <div style=" margin-top: 15px; ">


                        <table class="table table table-hover m-0">
                            <thead>
                            <tr>
                                <th>消费时间</th>
                                <th>消费门店</th>
                                <th>消费金额</th>
                                <th>消费类型</th>

                            </tr>
                            </thead>
                            <tbody id="xfjl">

                            </tbody>
                        </table>
                        <div id="pagecount" class="pagecount"></div>
                    </div>
                </div>
                <div class="tab-pane fade" id="member-wxconsume">
                    <div style=" margin-top: 15px; ">

                        <table class="table table table-hover m-0">
                            <thead>
                            <tr>
                                <th>消费时间</th>
                                <th>消费门店</th>
                                <th>消费金额</th>
                                <th>支付类型</th>
                                <th>消费方式</th>
                            </tr>
                            </thead>
                            <tbody id="wxxfjl">

                            </tbody>
                        </table>
                        <div id="pagecounts1" class="pagecount"></div>
                    </div>
                </div>
                <div class="tab-pane fade" id="member-recharge">
                    <div style=" margin-top: 15px; ">

                        <table class="table table table-hover m-0">
                            <thead>
                            <tr>
                                <th>充值时间</th>
                                <th>充值门店</th>
                                <th>充值金额</th>
                                <th>充值方式</th>
                            </tr>
                            </thead>
                            <tbody id="cczje">

                            </tbody>
                        </table>
                        <div id="pagecounts" class="pagecount"></div>
                    </div>
                </div>
                <div class="tab-pane fade" id="member-point">
                    <div style=" margin-top: 15px; ">

                        <table class="table table table-hover m-0">
                            <thead>
                            <tr>
                                <th>变动时间</th>
                                <th>变动积分</th>
                                <th>变动类型</th>
                            </tr>
                            </thead>
                            <tbody id="jfjl">

                            </tbody>
                        </table>
                        <div id="pagecount2" class="pagecount"></div>
                    </div>
                </div>
                <div class="tab-pane fade" id="member-coupon">
                    <div style=" margin-top: 15px; ">

                        <table class="table table table-hover m-0">
                            <thead>
                            <tr>
                                <th>领取时间</th>
                                <th>优惠券类型</th>
                                <th>门店名称</th>
                                <th>卡券状态</th>
                                <th>优惠券名称</th>


                            </tr>
                            </thead>
                            <tbody id="yhqlq">

                            </tbody>
                        </table>
                        <div id="pagecount3" class="pagecount"></div>
                    </div>
                </div>

                <div class="tab-pane fade" id="member-redenvelope">
                    <div style=" margin-top: 15px; ">

                        <table class="table table table-hover m-0">
                            <thead>
                            <tr>
                                <th>备注时间</th>
                                <th>备注人</th>
                                <th>备注详情</th>


                            </tr>
                            </thead>
                            <tbody id="bzjl">

                            </tbody>
                        </table>
                        <div id="pagecount4" class="pagecount"></div>
                    </div>
                </div>


            </div>

        </div>
    </div>
</div>
<!-- 修改个人资料模态框（Modal） -->
<div class="modal fade" id="myModal3" tabindex="-1" role="dialog" aria-labelledby="myModalLabel" aria-hidden="true">
    <div class="modal-dialog">
        <div class="modal-content">
            <div class="modal-header">
                <button type="button" class="close" data-dismiss="modal"
                        aria-hidden="true">×
                </button>
                <h4 class="modal-title" id="myModalLabel">
                    编辑会员信息
                </h4>
            </div>
            <div class="modal-body">
                <form name="editMemberForm" id="editMemberForm" method="post">
                    <div class="form-group">
                        <input type="hidden" class="form-control edit-ipt" id="openid1" name="openid" value="">
                        <input type="hidden" class="form-control edit-ipt" id="code1" name="code" value="">
                        <label for="recipient-name" class="control-label">会员姓名：</label>
                        <input type="text" class="form-control edit-ipt" id="e_memberName" name="name" value=""
                               placeholder="会员姓名">
                        <label for="message-text" class="control-label edit-lf">会员昵称：</label>
                        <input type="text" class="form-control edit-ipt" id="e_nickName" name="nickname" value=""
                               placeholder="会员昵称">
                    </div>
                    <div class="form-group">
                        <label for="message-text" class="control-label">会员手机：</label>
                        <input type="text" class="form-control edit-ipt" id="e_mobile" maxlength="11" name="phone"
                               value="" placeholder="手机号码" onkeyup="this.value=this.value.replace(/\D/gi,"")">
                        <label for="message-text" class="control-label edit-lf">会员邮箱：</label>
                        <input class="form-control edit-ipt" id="e_email" type="text" name="email" value
                               placeholder="会员邮箱">
                    </div>
                    <div class="form-group">
                        <label for="message-text" class="control-label">会员性别：</label>
                        <select class="form-control select2 edit-ipt select2-hidden-accessible" name="sex" id="m_sex"
                                tabindex="-1" aria-hidden="true">
                            <option value="2">未知</option>
                            <option value="1">男</option>
                            <option value="0">女</option>
                        </select>
                        <label for="message-text" class="control-label edit-lf">会员生日：</label>

                        <input type="text" class="form-control com-interval com-time edit-ipt" id='e_birthday' readonly
                               name='birthday' placeholder="会员生日" value="">

                        <!--<label for="message-text" class="control-label edit-lf">会员等级：</label>-->
                        <!--<input class="form-control edit-ipt" id="levelId" readonly="readonly" type="text" name="level" value placeholder="会员等级">-->


                    </div>
                    <div class="form-group">
                        <label for="message-text" class="control-label">会员状态：</label>
                        <select class="form-control select2 edit-ipt select2-hidden-accessible" name="status" id="m_status"
                                tabindex="-1" aria-hidden="true">
                            <option value="1">正常</option>
                            <option value="2">停用</option>

                        </select>


                        <!--<label for="message-text" class="control-label edit-lf">会员等级：</label>-->
                        <!--<input class="form-control edit-ipt" id="levelId" readonly="readonly" type="text" name="level" value placeholder="会员等级">-->


                    </div>
                    <div class="form-group">
                        <label for="beizhu" class="control-label">备注：</label>
                        <input type="text" class="form-control" id="beizhu" name="remark" value="" placeholder="请输入备注">

                    </div>

                </form>
            </div>
            <div class="modal-footer">
                <button type="button" class="btn btn-default"
                        data-dismiss="modal">关闭
                </button>
                <button type="button" class="btn btn-primary" id="btn-primary">
                    提交更改
                </button>
            </div>
        </div><!-- /.modal-content -->
    </div><!-- /.modal-dialog -->
</div><!-- /.modal -->
<!-- Modal -->


<div class="modal fade" id="myModal5" tabindex="-1" role="dialog" aria-labelledby="myModalLabel">
    <div class="modal-dialog" role="document" style="width: 600px;">
        <div class="modal-content">
            <div class="modal-header">
                <button type="button" class="close" data-dismiss="modal" aria-label="Close"><span aria-hidden="true">&times;</span>
                </button>
                <h4 class="modal-title" id="myModalLabel5" style="font-size: 16px;">发送群发</h4>

            </div>
            <div class="modal-body">
                <ul id="myTab1" class="nav nav-tabs">

                    <li class="tabios active"><a href="#card_qf" data-toggle="tab">卡券群发</a></li>

                    <li class=" tabhome">
                        <a href="#xx_qf" data-toggle="tab">
                            信息群发
                        </a>
                    </li>


                </ul>
                <div id="myTabContent" class="tab-content">

                    <div class="tab-pane fade text-center in active" id="card_qf">
                        <div class="panel" style="margin-top:5px">
                            <div class="panel-body">
                                <div class="alert alert-warning" style="font-size:13px">
                                    <ol>
                                        <!--<li id="alert-warning">1.需先前往会员卡设置跟随推荐。注意：单次发送请勿超过100人！！！-->
                                        <!--</li>-->
                                        <li>1.注意！消息群发将以"会员列表"页面中"会员查询"面板上设置的筛选条件，对发送对象进行筛选(未点击"查询"按钮时,筛选条件同样有效，请务必注意)。</li>
                                        <li>2.群发内容超过16个字的部分将被微信省略,顾群发内容不得超过16个字。</li>
                                        <!--<li>3.赠券结果 在 “卡券中心”&ndash;&gt;“未领取”中，建议在消息内容里说明赠券详情和如何领取到赠券。</li>-->
                                    </ol>
                                </div>
                            </div>
                        </div>
                        <div class="" style="border:none;">

                            <div class="panel panel-default  mgl15 mgr15">


                                <div class="panel-body">
                                    <form class="form-horizontal" id="tests">

                                        <input type="hidden" name="card_id" value="{$card['card_id']}">
                                        <div class="panel-body">

                                            <div class="form-horizontal" data-label="赠送积分"
                                                 data-layout="horizontal">
                                                <div class="form-group">
                                                    <label class="col-sm-2 control-label">赠送积分</label>
                                                    <div class="col-sm-10">
                                                        <input name="add_bonus" type="number" value=""
                                                               onkeyup="NumberCheck(this)" id="add_bonuss"
                                                               class="form-control" placeholder="请选择" style="">
                                                        <input type="hidden" value="" name="senduserlist"
                                                               id="senduserlist">
                                                        <div class="r-message text-danger"></div>
                                                    </div>
                                                </div>
                                            </div>
                                            <div class="form-horizontal" data-label="赠送卡券"
                                                 data-layout="horizontal">
                                                <div class="form-group">
                                                    <label class="col-sm-2 control-label">赠送卡券</label>
                                                    <div class="col-sm-10">
                                                        <a href="javascript:;" data-counts="1" id="datacount"
                                                           style="color: #2db7f5;font-size: 13px;text-align: left;line-height: 37px;">添加赠送</a>
                                                        <div class="col-xs-10 col-sm-10 col-md-10 form1">
                                                            <div class="gift-record" id="sel1">
                                                                <select name="card_arr[zs_card_id][]"
                                                                        class="form-control cardsel" id="opt">
                                                                    <option value="">--请选择--</option>
                                                                </select>
                                                                <input type="number" class="form-control" min="1"
                                                                       placeholder="请填写" value="1"
                                                                       name="card_arr[zs_no][]" data="num" id="num">
                                                            </div>

                                                        </div>
                                                        <div class="r-message text-danger"></div>
                                                    </div>
                                                </div>
                                            </div>
                                            <div class="form-horizontal" data-label="消息内容"
                                                 data-layout="horizontal">
                                                <div class="form-group">
                                                    <label class="col-sm-2 control-label">消息内容</label>
                                                    <div class="col-sm-10">
                                                        <textarea name="text" type="text" id="text" class="form-control"
                                                                  placeholder="请选择" style=""
                                                                  onchange="tex('text','btext','16');"></textarea>
                                                        <div class="help-block" id="btext"></div>
                                                    </div>
                                                </div>
                                            </div>
                                            <div class="progress progress-striped active" style="display:none">
                                                <div class="progress-bar progress-bar-success" id="progress-bar"
                                                     role="progressbar"
                                                     aria-valuenow="60" aria-valuemin="0" aria-valuemax="100"
                                                     style="width: 100%;">
                                                    <span class="sr-only">40% 完成</span>
                                                </div>
                                            </div>

                                        </div>

                                    </form>
                                </div>
                            </div>


                            <div class="modal-footer">

                                <button type="button" class="btn btn-primary" onclick="fafirecard(this)">发送</button>
                                <button type="button" class="btn btn-default" data-dismiss="modal">关闭</button>
                            </div>

                        </div>
                    </div>
                    <div class="tab-pane fade  text-center" id="xx_qf">
                        <div class="panel" style="margin-top:5px">
                            <div class="panel-body">
                                <div class="alert alert-warning" style="font-size:13px">
                                    <ol>
                                        <li>1.注意！消息群发将以"会员列表"页面中"会员查询"面板上设置的筛选条件，对发送对象进行筛选(未点击"查询"按钮时,筛选条件同样有效，请务必注意)。
                                        </li>
                                        <li>2.群发内容超过160个字的部分将被微信省略,故群发内容不得超过160个字。</li>

                                    </ol>
                                </div>
                            </div>
                        </div>
                        <div class="" style="border:none;">

                            <div class="panel panel-default  mgl15 mgr15">


                                <div class="panel-body">
                                    <form class="form-horizontal" id="tests1">

                                        <input type="hidden" name="card_id" value="{$card['card_id']}">
                                        <div class="panel-body">

                                            <div class="form-horizontal" data-label="赠送积分"
                                                 data-layout="horizontal">
                                                <div class="form-group">
                                                    <label class="col-sm-2 control-label">赠送积分</label>
                                                    <div class="col-sm-10">
                                                        <input name="add_bonus_mass" type="number" value=""
                                                               onkeyup="NumberCheck(this)" id="add_bonus_mass"
                                                               class="form-control" placeholder="请选择" style="">
                                                        <input type="hidden" value="" name="senduserlist_mass"
                                                               id="senduserlist_mass">
                                                        <div class="r-message text-danger"></div>
                                                    </div>
                                                </div>
                                            </div>
                                            <div class="form-horizontal" data-label="消息内容"
                                                 data-layout="horizontal">
                                                <div class="form-group">
                                                    <label class="col-sm-2 control-label">消息内容</label>
                                                    <div class="col-sm-10">
                                                        <textarea name="remark_mass" type="text" id="remark_mass"
                                                                  class="form-control" placeholder="请选择" style=""
                                                                  onchange="tex('text','btext','16');"></textarea>
                                                        <div class="help-block" id="btext1"></div>
                                                    </div>
                                                </div>
                                            </div>
                                            <div class="progress progress-striped active" style="display:none">
                                                <div class="progress-bar progress-bar-success" id="progress-bar1"
                                                     role="progressbar"
                                                     aria-valuenow="60" aria-valuemin="0" aria-valuemax="100"
                                                     style="width: 100%;">
                                                    <span class="sr-only">40% 完成</span>
                                                </div>
                                            </div>

                                        </div>

                                    </form>
                                </div>
                            </div>


                            <div class="modal-footer">

                                <button type="button" class="btn btn-primary" onclick="fafirexx(this)">发送</button>
                                <button type="button" class="btn btn-default" data-dismiss="modal">关闭</button>
                            </div>

                        </div>
                    </div>
                </div>


            </div>


        </div>
    </div>
</div>
<div class="sidenav-overlay absolute"></div>

<script src="__STATIC_URL__/static/js/template.js"></script>
<script src="__STATIC_URL__/static/layer/layer.js"></script>
<script src="__STATIC_URL__/static/laydate/laydate.js"></script>
<script src="__STATIC_URL__/static/bootstrap-table/bootstrap-table.js"></script>
<script src="__STATIC_URL__/static/bootstrap-table/bootstrap-table-zh-CN.js"></script>
<script src="/wntables.js?v=3"></script>
<script src="/getlists_cs.js"></script>
<script>
    $(function () {
        $.ajax({
            url: "{:url('cards/getcardlist')}",
            type: "post",
            data: {},
            success: function (data) {

                var text = data.data;
                //console.log(text);
                var option2 = "";
                for (var i = 0; i < text.length; i++) {
                    // console.log(text[i].card_id);

                    option2 += '<option value="' + text[i].card_id + '" data-title="' + text[i].title + ' "data-limit="' + text[i].get_limit + '">' + text[i].title + '  ( 最大可选卡券数量为' + text[i].get_limit + ' )</option>\n'

                }
                $('#sel1').find("select").append(option2);
                $("#opt").change(function () {

                    limit = parseInt($("#sel1").find("option:selected").attr("data-limit"));
                    var nu = parseInt($("#num").val());

                    $("#num").attr("max", limit);
                    //console.log(333333,limit);


                });

                $("#datacount").click(function () {


                    datacount = $(this).attr('data-counts');
                    get_limit = parseInt($("#sel" + datacount).find("option:selected").attr("data-limit"));
                    num = parseInt($("#sel" + datacount).find("input").val());
                    val = $("#sel" + datacount).find("option:selected").val();
                    if ($("#sel" + datacount).find("option:selected").val() == "") {
                        alert("卡券选项不能为空");
                        return;
                    }
                    else if (num > get_limit) {
                        console.log(num, get_limit);
                        console.log(num > get_limit);
                        alert("你选择的卡券数量超过了该卡券的领取数量!");
                        return;
                    }
                    else {

                        datacount2 = parseInt(datacount) + 1;
                        $(this).attr('data-counts', datacount2);
                        var html1 = '                        <div class="col-xs-12 col-sm-12 col-md-12 addcord" >\n' +
                            '                            <div class="gift-record"id="sel' + datacount2 + '">\n' +
                            '                                <select name="card_arr[zs_card_id][]"  class="form-control" >\n' +
                            '                                    <option value="" selected="selected">--请选择--</option>\n';

                        var html3 = '                                </select>\n' +
                            '                                <input type="number" class="form-control" min="1" placeholder="请填写" value="1" name="card_arr[zs_no][]">\n' +
                            '                            </div>\n' +
                            '                             <a href="javascript:;" onclick="delsel(this)" style="font-size: 13px;">删除</a>\n' +
                            '                    </div>';

                        $('.form1').append(html1 + option2 + html3);

                        $("#sel" + datacount2).find("select").change(function () {

                            limit = $("#sel" + datacount2).find("option:selected").attr("data-limit");
                            $("#sel" + datacount2).find("input").attr("max", limit);


                        });

                    }


                })
            }
        })


    })
</script>
<script>
    /**验证字数*/
    function tex(idq, tex, num) {
        // console.log(idq,tex,num)
        $("#" + tex).text("还可以输入" + (num - $("#" + idq).val().length) + "个字");


        if ($("#" + idq).val().length > num) {
            $("#" + idq).val($("#" + idq).val().substring(0, num));
        }
        $("#" + tex).text("还可以输入" + (num - $("#" + idq).val().length) + "个字");
        var val = $("#" + idq).val();
        $("." + idq).html(val)
        $("." + idq).val(val)
//console.log($("#"+idq).val());
    }
</script>
<script>


    $(function () {
        var type = "getlists";
        var url = "{:url('cardus/getlists')}";
        var src = "__STATIC_URL__";

        getcolumn(type, url, "tablelist", src)
    });
    $(function () {
        $('#myModal5').on('show.bs.modal',
            function () {
                getcardsid();
            })

    })

    function getcardsid() {

        $.ajax({
            url: "{:url()}",
            type: "post",
            async: true,
            data: {
                gs_mid: $("#gs_mid").val(),
                nickname: $("#nicknames").val(),
                code: $("#codes").val(),//后台请求传的查询参数
                fire: $("#fire").val(),
                search_type: "send_card",
                bonus_scr: $("#bonus_scr").val(),//后台请求传的查询参数
                balance_scr: $("#balance_scr").val(),
                get_scr: $("#get_scr").val(),
                min_bonus: $("#min_bonus").val(),
                max_bonus: $("#max_bonus").val(),
                min_balance: $("#min_balance").val(),
                max_balance: $("#max_balance").val(),
                last_day:$("#last_day").val(),
                birthday_day:$("#birthday_day").val(),
                con_balance_scr:$("#con_balance_scr").val(),
                con_bonus_scr:$("#con_bonus_scr").val(),
                add_balance_scr:$("#add_balance_scr").val(),
                times: $("#times").val()
            },
            success: function (res) {
                $('#senduserlist').val(res);
                $('#senduserlist_mass').val(res);
            }
        })

    }

    //搜索
    function searchforms() {
        $("#tablelist").bootstrapTable('refresh');
    }

</script>
<script>

</script>
<script>
    $("#czsure").click(function () {
        var mid = $("#czhe-md").val();
        var user = $("#cznickname").val();
        var kind = $("#cz-kind").val();
        if (mid == "") {
            layer.alert("请选择门店", {icon: 7});
            return false;
        }
        if (nickname == "") {
            layer.alert("核销员不能为空", {icon: 7});
            return false;
        }
        if (kind == '1') {
            hexiao("{:url('cardus/getrecharge')}", "cz", 'czsure')
        } else if (kind == '2') {
            hexiao("{:url('cardus/inc_bonus')}", "cz", 'czsure')
        } else {
            layer.alert("请选择充值类型！", {icon: 7});
            return false;
        }

    })
    $("#hxsure").click(function () {
        var mid = $("#he-md").val();
        var user = $("#nickname").val();
        var type = $("#modal-type").val();
        var kind = $("#he-type").val();
        // console.log(33,kind);
        if (type == "") {
            layer.alert("请重新选择操作", {icon: 7});
            return false;
        }
        if (mid == "") {
            layer.alert("请选择门店", {icon: 7});
            return false;
        }
        if (nickname == "") {
            layer.alert("核销员不能为空", {icon: 7});
            return false;
        }
        if (kind == '1') {
            hexiao("{:url('cardus/getcardupdate')}", "hexiao", 'hxsure');
        } else if (kind == '2') {
            hexiao("{:url('cardus/hx_bonus')}", "hexiao", 'hxsure');
        }
    })


</script>
</body>


</html>
